﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Configuration;
using System.Data.SqlClient;
using System.Data;

namespace CourseBook
{
    public class DataProvider
    {
        public SqlConnection con;
       
        public DataProvider()
        { 
        }
        public void Connect()
        {
            if (con == null)
                con = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);
            if (con.State == ConnectionState.Closed)
                con.Open();
        }
        public void Disconnect()
        {
            if ((con != null) && (con.State == ConnectionState.Open))
                con.Close();
        }
    }
}